import request from '@/utils/request'

export function getRoleList() {
  return request({
    url: '/role/list',
    method: 'get'
  })
}

export function getRoleListByAdminId(adminId) {
  return request({
    url: '/role/getListByAdminId/' + adminId,
    method: 'get'
  })
}

export function addadminRole(data) {
  return request({
    url: '/adminRole/addListAdminRole',
    method: 'post',
    data
  })
}

export function getListTree(querys) {
  return request({
    url: '/role/listTree',
    method: 'get',
    params: querys
  })
}

export function delRole(id) {
  return request({
    url: '/role/del/' + id,
    method: 'get'
  })
}

export function saveRole(data) {
  return request({
    url: '/role/save',
    method: 'post',
    data
  })
}

export function delMenuChildrenByRoleId(rid, menuId) {
  return request({
    url: `/menuRole/delMenuChildrenByRoleId/${rid}/${menuId}`,
    method: 'get'
  })
}

export function getRoleMenuById(rid) {
  return request({
    url: `/menuRole/getRoleMenuById/${rid}`,
    method: 'get'
  })
}

export function getRoleMenu() {
  return request({
    url: `/menuRole/getRoleMenu`,
    method: 'get'
  })
}

export function addMenuRoles(data) {
  return request({
    url: `/menuRole/addMenuRoles`,
    method: 'post',
    data
  })
}
